﻿using System.Collections.Generic;
using xTeam.Glgcx.CommonUtilities;
using xTeam.Glgcx.DataAccess;
using Microsoft.International.Converters.PinYinConverter;
using System.Text.RegularExpressions;
using ShopB2C.Core.Helpers;

namespace xTeam.Glgcx.Business
{
    public class ClassiyfBal
    {
        private ClassifyDataAccess _classifyDataAccess;

        public ClassiyfBal()
        {
            _classifyDataAccess = new ClassifyDataAccess();
        }

        public List<EClassify> GetClassiyfListByModuleKey(string moduleKey)
        {
            return _classifyDataAccess.GetClassifyList(moduleKey);

        }

        public EClassify GetClassifyById(int classifyId)
        {
            return _classifyDataAccess.GetClassifyById(classifyId);
        }

        public int Save(EClassify classify)
        {
            if (string.IsNullOrEmpty(classify.ETag))
                classify.ETag = classify.Title;
            return _classifyDataAccess.Update(classify);
        }

        public int Delete(int classifyId)
        {
            return _classifyDataAccess.Delete(classifyId);
        }

        public EClassify GetClassifytByETag(string tagName, string moduleKey)
        {
            return _classifyDataAccess.GetClassifyETag(tagName, moduleKey);
        }
    }
}
